<?php

namespace App\Admin\Controllers;

use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
use Illuminate\Http\Request;

class AuthController extends BaseAuthController
{
    /**
     * 登录页面视图.
     * laravel-box定义.
     *
     * @var string
     */
    protected $view = 'admin.login';


    // /**
    //  * @var string
    //  */
    // protected $redirectTo;

    // /**
    //  * Show the login page.
    //  *
    //  * @return Content|\Illuminate\Http\RedirectResponse
    //  */
    // public function getLogin(Content $content)
    // {
    //     if ($this->guard()->check()) {
    //         return redirect($this->getRedirectPath());
    //     }

    //     return $content->full()->body(view($this->view));
    // }


    // /**
    //  * Handle a login request.
    //  *
    //  * @param  Request  $request
    //  * @return mixed
    //  */
    // public function postLogin(Request $request)
    // {
    //     $credentials = $request->only([$this->username(), 'password']);
    //     $remember = (bool) $request->input('remember', false);

    //     /** @var \Illuminate\Validation\Validator $validator */
    //     $validator = Validator::make($credentials, [
    //         $this->username()   => 'required|exists:admin_users,username,status,1',
    //         'password'          => 'required',
    //     ], [
    //         'exists' => '该账户已停用，请联系管理员！',
    //     ]);

    //     if ($validator->fails()) {
    //         return $this->validationErrorsResponse($validator);
    //     }

    //     if ($this->guard()->attempt($credentials, $remember)) {
    //         return $this->sendLoginResponse($request);
    //     }

    //     return $this->validationErrorsResponse([
    //         $this->username() => $this->getFailedLoginMessage(),
    //     ]);
    // }
}
